import json
import requests
import time

url = 'https://lab.isaaclin.cn/nCoV/api/area'
r = requests.request('GET', url)

data_c = r.json()
date = time.strftime("%Y-%m-%d")
for item in data_c['results']:
    if item['countryName'] == "中国":
        province = item['provinceEnglishName']
        if province == "Hong Kong":
            province = "HongKong"
        elif province == "China":
            continue
        currentConfirmedCount = item['currentConfirmedCount']
        cured = item['curedCount']
        dead = item['deadCount']
        suspected = item['suspectedCount']
        SQLstr = "INSERT " + str(province) + "(date,currentConfirmedCount,cured,dead,suspected) VALUES('" + \
            str(date) + "'," + str(currentConfirmedCount) + "," + str(cured) + \
            "," + str(dead) + "," + str(suspected) + ");"
        print(SQLstr)
